<?php

class Default_Model_Form_Message extends Zend_Form {

    public function __construct($options = null) {
        parent::__construct($options);
        $this->setName('category');

        $name = new Zend_Form_Element_Text('name');
        $name->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('size', 30);

        $phone = new Zend_Form_Element_Text('phone');
        $phone->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('size', 30);

        $mail = new Zend_Form_Element_Text('mail');
        $mail->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('size', 30);

        $message = new Zend_Form_Element_Textarea('message');
        $message->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('rows', 10)
                ->setAttrib('cols', 20);

        $captcha = new Zend_Form_Element_Captcha(
                        'captcha',
                        array('label' => 'Write the chars to the field',
                            'captcha' => array(
                                'captcha' => 'Image',
                                'wordLen' => 3,
                                'timeout' => 300,
                                'font' => $_SERVER["DOCUMENT_ROOT"] . 'capcha/font1.ttf',
                                'imgDir' => $_SERVER["DOCUMENT_ROOT"] . 'capcha/image/',
                                'imgUrl' => 'http://' . $_SERVER['HTTP_HOST'] . '/capcha/image/',
                        )));


        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');


        $this->addElements(array($name, $phone, $mail, $message, $captcha, $submit));
    }

}